Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(icons): adding IconPasskey #612

Merged
merged 3 commits into from
Aug 31, 2024
Merged

Conversation

aversini
Copy link
Collaborator

@aversini aversini commented Aug 31, 2024

PR Type

enhancement


Description

  • Introduced a new IconPasskey component in the ui-icons package.
  • Added SVG paths and customization options for the IconPasskey.
  • Updated the component index to include and export the IconPasskey.
  • Configured the IconPasskey in the icons configuration file with properties like name, title, and monotone.

Changes walkthrough 📝

Relevant files
Enhancement
IconPasskey.tsx
Add new IconPasskey component with SVG paths                         

packages/ui-icons/src/components/Icons/IconPasskey.tsx

  • Added a new IconPasskey component.
  • Implemented SVG paths for the icon.
  • Included properties for customization such as className, viewBox, and
    title.
  • +49/-0   
    index.ts
    Export new IconPasskey component                                                 

    packages/ui-icons/src/components/index.ts

  • Imported the new IconPasskey component.
  • Exported the IconPasskey for external use.
  • +2/-0     
    Configuration changes
    config.json
    Add IconPasskey configuration                                                       

    packages/ui-icons/lib/icons/config.json

  • Added configuration for the new IconPasskey.
  • Set properties such as name, title, and monotone.
  • +5/-0     

    💡 PR-Agent usage:
    Comment /help on the PR to get a list of all available PR-Agent tools and their descriptions

    Summary by CodeRabbit

    • New Features
      • Introduced a new "Passkey" icon to the icon library, enhancing the available icon set.
      • Added a reusable IconPasskey component for SVG representation of the passkey icon.
      • Updated the icon index to include the new IconPasskey for easy access within the application.
    • Tests
      • Enhanced test coverage by adding tests for the new IconPasskey component.

    Copy link

    coderabbitai bot commented Aug 31, 2024

    Walkthrough

    The changes introduce a new icon, "Passkey," to the UI icon library. This includes an entry in the icon configuration JSON and the creation of a new React component, IconPasskey, which renders the SVG representation of the passkey icon. The component is then exported from the main index file, making it available for use throughout the application. Additionally, test cases for the new icon have been added to ensure proper functionality.

    Changes

    Files Change Summary
    packages/ui-icons/lib/icons/config.json Added new entry for passkey with properties: name, title, and monotone.
    packages/ui-icons/src/components/Icons/IconPasskey.tsx Created IconPasskey component using SvgIcon, defining SVG paths and customizable properties.
    packages/ui-icons/src/components/index.ts Added import and export statements for IconPasskey, integrating it into the icon library.
    packages/ui-icons/src/components/Icons/__tests__/Icons.test.tsx Added tests for IconPasskey, including rendering with various props and updating the dataTestId array.

    Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

    Share
    Tips

    Chat

    There are 3 ways to chat with CodeRabbit:

    • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
      • I pushed a fix in commit <commit_id>.
      • Generate unit testing code for this file.
      • Open a follow-up GitHub issue for this discussion.
    • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
      • @coderabbitai generate unit testing code for this file.
      • @coderabbitai modularize this function.
    • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
      • @coderabbitai generate interesting stats about this repository and render them as a table.
      • @coderabbitai show all the console.log statements in this repository.
      • @coderabbitai read src/utils.ts and generate unit testing code.
      • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
      • @coderabbitai help me debug CodeRabbit configuration file.

    Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

    CodeRabbit Commands (Invoked using PR comments)

    • @coderabbitai pause to pause the reviews on a PR.
    • @coderabbitai resume to resume the paused reviews.
    • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
    • @coderabbitai full review to do a full review from scratch and review all the files again.
    • @coderabbitai summary to regenerate the summary of the PR.
    • @coderabbitai resolve resolve all the CodeRabbit review comments.
    • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
    • @coderabbitai help to get help.

    Other keywords and placeholders

    • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
    • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
    • Add @coderabbitai anywhere in the PR title to generate the title automatically.

    Documentation and Community

    • Visit our Documentation for detailed information on how to use CodeRabbit.
    • Join our Discord Community to get help, request features, and share feedback.
    • Follow us on X/Twitter for updates and announcements.

    Copy link

    PR Reviewer Guide 🔍

    ⏱️ Estimated effort to review: 2 🔵🔵⚪⚪⚪
    🧪 No relevant tests
    🔒 No security concerns identified
    ⚡ Key issues to review

    Code Duplication
    The opacity calculation is duplicated in two separate path elements. Consider extracting this logic to a variable to improve maintainability.

    Unnecessary Comment
    The comment "/* v8 ignore next 1 */" seems unnecessary and its purpose is unclear. Consider removing it if it's not serving a specific function.

    Copy link

    PR Code Suggestions ✨

    CategorySuggestion                                                                                                                                    Score
    Best practice
    Extract magic string to a constant for better maintainability

    Consider using a constant for the default view box value "0 0 216 216" to improve
    maintainability and reduce the risk of typos.

    packages/ui-icons/src/components/Icons/IconPasskey.tsx [28-36]

    +const DEFAULT_VIEWBOX = "0 0 216 216";
    +
    +// ... (earlier in the file)
    +
     <SvgIcon
    -  defaultViewBox="0 0 216 216"
    +  defaultViewBox={DEFAULT_VIEWBOX}
       defaultClassName="size-5"
       viewBox={viewBox}
       className={className}
       spacing={spacing}
       title={title || "Passkey"}
       {...rest}
     >
     
    • Apply this suggestion
    Suggestion importance[1-10]: 7

    Why: Extracting the magic string to a constant improves maintainability and reduces the risk of errors if the value needs to be updated in multiple places. However, it's a minor improvement and not crucial for functionality.

    7
    Maintainability
    Use a more descriptive name for the rest parameter

    Consider using a more descriptive variable name instead of rest for better code
    readability and understanding of the remaining props.

    packages/ui-icons/src/components/Icons/IconPasskey.tsx [17-24]

     export const IconPasskey = ({
       className,
       viewBox,
       spacing,
       title,
       monotone,
    -  ...rest
    +  ...otherProps
     }: IconsProps) => {
     
    • Apply this suggestion
    Suggestion importance[1-10]: 6

    Why: Using a more descriptive name for the rest parameter can improve code readability, but the existing name 'rest' is already a common convention and not confusing, so the improvement is minor.

    6
    Enhancement
    Simplify opacity assignment using inline ternary operator

    Consider using a ternary operator instead of the opacity variable assignment to
    simplify the code and improve readability.

    packages/ui-icons/src/components/Icons/IconPasskey.tsx [25-40]

    -/* v8 ignore next 1 */
    -const opacity = monotone ? "1" : "0.4";
     return (
       <SvgIcon
         defaultViewBox="0 0 216 216"
         defaultClassName="size-5"
         viewBox={viewBox}
         className={className}
         spacing={spacing}
         title={title || "Passkey"}
         {...rest}
       >
         <path
    -      opacity={opacity}
    +      opacity={monotone ? "1" : "0.4"}
           d="M172.32,96.79c0,13.78-8.48,25.5-20.29,29.78l7.14,11.83l-10.57,13l10.57,12.71l-17.04,22.87l-12.01-12.82 v-25.9v-22.56c-10.68-4.85-18.15-15.97-18.15-28.91c0-17.4,13.51-31.51,30.18-31.51C158.81,65.28,172.32,79.39,172.32,96.79z M142.14,101.61c4.02,0,7.28-3.4,7.28-7.6c0-4.2-3.26-7.61-7.28-7.61s-7.28,3.4-7.28,7.61 C134.85,98.21,138.12,101.61,142.14,101.61z"
         />
     
    • Apply this suggestion
    Suggestion importance[1-10]: 5

    Why: Simplifying the opacity assignment with an inline ternary operator can slightly improve readability, but the existing code is already clear and the change is not necessary for functionality.

    5

    Copy link

    qodo-merge-pro bot commented Aug 31, 2024

    CI Failure Feedback 🧐

    (Checks updated until commit 5899253)

    Action: inspect (20.x)

    Failed stage: Run corepack enable [❌]

    Failed test name: @versini/ui-icons:test:coverage

    Failure summary:

    The action failed due to insufficient code coverage:

  • Coverage for lines is 97.78%, which does not meet the global threshold of 100%.
  • Coverage for functions is 96.77%, which does not meet the global threshold of 100%.
  • Coverage for statements is 97.78%, which does not meet the global threshold of 100%.
  • The failure occurred in the @versini/ui-icons:test:coverage task.

  • Relevant error logs:
    1:  ##[group]Operating System
    2:  Ubuntu
    ...
    
    815:  �[32;1m  IconShow.tsx    �[0m | �[32;1m    100�[0m | �[32;1m     100�[0m | �[32;1m    100�[0m | �[32;1m    100�[0m | �[33;1m                 �[0m 
    816:  �[32;1m  IconSort.tsx    �[0m | �[32;1m    100�[0m | �[32;1m     100�[0m | �[32;1m    100�[0m | �[32;1m    100�[0m | �[33;1m                 �[0m 
    817:  �[32;1m  IconSortDown.tsx�[0m | �[32;1m    100�[0m | �[32;1m     100�[0m | �[32;1m    100�[0m | �[32;1m    100�[0m | �[33;1m                 �[0m 
    818:  �[32;1m  IconSortUp.tsx  �[0m | �[32;1m    100�[0m | �[32;1m     100�[0m | �[32;1m    100�[0m | �[32;1m    100�[0m | �[33;1m                 �[0m 
    819:  �[32;1m  ...rInCircle.tsx�[0m | �[32;1m    100�[0m | �[32;1m     100�[0m | �[32;1m    100�[0m | �[32;1m    100�[0m | �[33;1m                 �[0m 
    820:  �[32;1m  IconUp.tsx      �[0m | �[32;1m    100�[0m | �[32;1m     100�[0m | �[32;1m    100�[0m | �[32;1m    100�[0m | �[33;1m                 �[0m 
    821:  �[32;1m  IconUser.tsx    �[0m | �[32;1m    100�[0m | �[32;1m     100�[0m | �[32;1m    100�[0m | �[32;1m    100�[0m | �[33;1m                 �[0m 
    822:  -------------------|---------|----------|---------|---------|-------------------
    823:  ERROR: Coverage for lines (97.78%) does not meet global threshold (100%)
    824:  ERROR: Coverage for functions (96.77%) does not meet global threshold (100%)
    825:  ERROR: Coverage for statements (97.78%) does not meet global threshold (100%)
    826:  �[41m�[30m ELIFECYCLE �[39m�[49m �[31mCommand failed with exit code 1.�[39m
    827:  ##[endgroup]
    828:  >  Lerna (powered by Nx)   Running target test:coverage for 8 projects failed
    829:  Tasks not run because their dependencies failed or --nx-bail=true:
    830:  - @versini/bundlesize:test:coverage
    831:  - @versini/ui-components:test:coverage
    832:  - @versini/ui-form:test:coverage
    833:  - @versini/ui-system:test:coverage
    834:  Failed tasks:
    835:  - @versini/ui-icons:test:coverage
    836:  ##[error]Process completed with exit code 1.
    

    ✨ CI feedback usage guide:

    The CI feedback tool (/checks) automatically triggers when a PR has a failed check.
    The tool analyzes the failed checks and provides several feedbacks:

    • Failed stage
    • Failed test name
    • Failure summary
    • Relevant error logs

    In addition to being automatically triggered, the tool can also be invoked manually by commenting on a PR:

    /checks "https://github.com/{repo_name}/actions/runs/{run_number}/job/{job_number}"
    

    where {repo_name} is the name of the repository, {run_number} is the run number of the failed check, and {job_number} is the job number of the failed check.

    Configuration options

    • enable_auto_checks_feedback - if set to true, the tool will automatically provide feedback when a check is failed. Default is true.
    • excluded_checks_list - a list of checks to exclude from the feedback, for example: ["check1", "check2"]. Default is an empty list.
    • enable_help_text - if set to true, the tool will provide a help message with the feedback. Default is true.
    • persistent_comment - if set to true, the tool will overwrite a previous checks comment with the new feedback. Default is true.
    • final_update_message - if persistent_comment is true and updating a previous checks message, the tool will also create a new message: "Persistent checks updated to latest commit". Default is true.

    See more information about the checks tool in the docs.

    Copy link

    @coderabbitai coderabbitai bot left a comment

    Choose a reason for hiding this comment

    The reason will be displayed to describe this comment to others. Learn more.

    Actionable comments posted: 0

    Review details

    Configuration used: .coderabbit.yaml
    Review profile: CHILL

    Commits

    Files that changed from the base of the PR and between 0efa39d and f2c62be.

    Files ignored due to path filters (1)
    • packages/ui-icons/lib/icons/svg/passkey.svg is excluded by !**/*.svg
    Files selected for processing (3)
    • packages/ui-icons/lib/icons/config.json (1 hunks)
    • packages/ui-icons/src/components/Icons/IconPasskey.tsx (1 hunks)
    • packages/ui-icons/src/components/index.ts (2 hunks)
    Files skipped from review due to trivial changes (1)
    • packages/ui-icons/src/components/Icons/IconPasskey.tsx
    Additional comments not posted (3)
    packages/ui-icons/src/components/index.ts (2)

    19-19: Import statement for IconPasskey is correctly added.

    The import path follows the established pattern and is correctly placed among other icon imports, maintaining consistency.


    52-52: Export statement for IconPasskey is correctly added.

    The export is grouped appropriately with other icon exports, ensuring that IconPasskey is available for use throughout the application.

    packages/ui-icons/lib/icons/config.json (1)

    138-141: New JSON entry for passkey is correctly added.

    The entry includes all necessary properties (name, title, monotone) and is consistent with the structure and standards used for other icons in the configuration. This addition will enhance the icon set by providing a new icon option for the UI.

    Copy link

    Bundle Size (components)

    Status File Size (Gzip) Limits
    style.css 7.36 KB 8 KB
    index.js 9.82 KB (-4 B -0.04%) 10 KB
    vendor.js 65.64 KB 67 KB

    Overall bundle size: 82.82 KB (-4 B 0.00%)
    Overall status: ✅

    Bundle Size (fingerprint)

    Status File Size (Gzip) Limits
    index.js 3.94 KB (-1 B -0.02%) 4 KB
    vendor.js 44.34 KB 45 KB

    Overall bundle size: 48.28 KB (-1 B 0.00%)
    Overall status: ✅

    Bundle Size (form components)

    Status File Size (Gzip) Limits
    index.js 5.12 KB (+2 B +0.04%) 20 KB
    vendor.js 44.46 KB 67 KB

    Overall bundle size: 49.58 KB (+2 B 0.00%)
    Overall status: ✅

    Bundle Size (system)

    Status File Size (Gzip) Limits
    style.css 7.67 KB 8 KB
    index.js 1.93 KB (+1 B +0.05%) 3 KB
    vendor.js 44.46 KB 46 KB

    Overall bundle size: 54.06 KB (+1 B 0.00%)
    Overall status: ✅

    Copy link

    @coderabbitai coderabbitai bot left a comment

    Choose a reason for hiding this comment

    The reason will be displayed to describe this comment to others. Learn more.

    Actionable comments posted: 1

    Review details

    Configuration used: .coderabbit.yaml
    Review profile: CHILL

    Commits

    Files that changed from the base of the PR and between f2c62be and 5899253.

    Files ignored due to path filters (1)
    • packages/ui-icons/lib/icons/svg/passkey.svg is excluded by !**/*.svg
    Files selected for processing (1)
    • packages/ui-icons/src/components/Icons/tests/Icons.test.tsx (3 hunks)
    Additional comments not posted (1)
    packages/ui-icons/src/components/Icons/__tests__/Icons.test.tsx (1)

    23-23: Ensure proper import path for IconPasskey.

    The import statement for IconPasskey is correct in terms of syntax. However, ensure that the relative path used ("../..") correctly points to the location of the IconPasskey component within the project structure.

    @aversini aversini merged commit 4de4c61 into main Aug 31, 2024
    5 checks passed
    @aversini aversini deleted the feat(icons)-adding-IconPasskey branch August 31, 2024 21:00
    @aversini aversini mentioned this pull request Aug 31, 2024
    aversini added a commit that referenced this pull request Aug 31, 2024
    ### **User description**
    :robot: I have created a release *beep* *boop*
    ---
    
    
    <details><summary>ui-icons: 1.12.0</summary>
    
    ##
    [1.12.0](ui-icons-v1.11.0...ui-icons-v1.12.0)
    (2024-08-31)
    
    
    ### Features
    
    * **icons:** adding IconPasskey
    ([#612](#612))
    ([4de4c61](4de4c61))
    </details>
    
    ---
    This PR was generated with [Release
    Please](https://github.com/googleapis/release-please). See
    [documentation](https://github.com/googleapis/release-please#release-please).
    
    
    ___
    
    ### **PR Type**
    enhancement, other
    
    
    ___
    
    ### **Description**
    - Updated the version of `ui-icons` to 1.12.0 in the release manifest
    and package.json.
    - Added a new feature `IconPasskey` in the `ui-icons` package.
    - Updated the changelog to document the new version and feature.
    
    
    
    ___
    
    
    
    ### **Changes walkthrough** 📝
    <table><thead><tr><th></th><th align="left">Relevant
    files</th></tr></thead><tbody><tr><td><strong>Configuration
    changes</strong></td><td><table>
    <tr>
      <td>
        <details>
    <summary><strong>.release-please-manifest.json</strong><dd><code>Update
    ui-icons version in release manifest</code>&nbsp; &nbsp; &nbsp; &nbsp;
    &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
    </dd></summary>
    <hr>
    
    .release-please-manifest.json
    
    - Updated version of `ui-icons` from 1.11.0 to 1.12.0.
    
    
    
    </details>
    
    
      </td>
    <td><a
    href="https://github.com/versini-org/ui-components/pull/613/files#diff-e38bb01e41ed5baa3c9e8111b86009ca62d4498d2aefd14d367cd6300dd8b126">+1/-1</a>&nbsp;
    &nbsp; &nbsp; </td>
    
    </tr>                    
    
    <tr>
      <td>
        <details>
    <summary><strong>package.json</strong><dd><code>Bump ui-icons package
    version to 1.12.0</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
    &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
    &nbsp; </dd></summary>
    <hr>
    
    packages/ui-icons/package.json
    
    - Bumped version from 1.11.0 to 1.12.0.
    
    
    
    </details>
    
    
      </td>
    <td><a
    href="https://github.com/versini-org/ui-components/pull/613/files#diff-3c3156e339862f0c8a65402113e75378538275e1ba995191f7d7a3aed00ab903">+1/-1</a>&nbsp;
    &nbsp; &nbsp; </td>
    
    </tr>                    
    </table></td></tr><tr><td><strong>Documentation</strong></td><td><table>
    <tr>
      <td>
        <details>
    <summary><strong>CHANGELOG.md</strong><dd><code>Add changelog for
    ui-icons version 1.12.0</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
    &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
    </dd></summary>
    <hr>
    
    packages/ui-icons/CHANGELOG.md
    
    <li>Added changelog entry for version 1.12.0.<br> <li> Documented the
    addition of <code>IconPasskey</code>.<br>
    
    
    </details>
    
    
      </td>
    <td><a
    href="https://github.com/versini-org/ui-components/pull/613/files#diff-208ae7cbc494c2b3c41efa7b751e481e598d9a5850a5aacb0cac0eec959e874a">+7/-0</a>&nbsp;
    &nbsp; &nbsp; </td>
    
    </tr>                    
    </table></td></tr></tr></tbody></table>
    
    ___
    
    > 💡 **PR-Agent usage**:
    >Comment `/help` on the PR to get a list of all available PR-Agent tools
    and their descriptions
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    Projects
    None yet
    Development

    Successfully merging this pull request may close these issues.

    1 participant